In [ ]:
%async_start_server

To verify that the server is actually running, go to http://127.0.0.1:5678/ping.

This is just a ping test

Very first run


In [ ]:
N = 10
N

In [ ]:
s = 5

In [ ]:
s

In [ ]:
l = 0

Update the value of a variable, asynchronously


In [ ]:
%%async_run 
N = 10**s
print(N)

The following cell has no output, just computation


In [ ]:
%%async_run
s += 1
l += 1

In [ ]:
s, l

In [ ]:
l += 1

In [ ]:
l

1. Output History is correctly updated


In [ ]:
_oh

2. Exception Output Handling

In this particular example, the L variable has been never defined, thus leading to a NameError exception


In [ ]:
%async_run L += 1

3. Let's do an heavy computation example


In [ ]:
%%async_run 
N = 10**7
s = sum([i**2 for i in range(N)])
print(s)

In [ ]:
s

4. Module Import in async_run cells


In [ ]:
from sklearn.datasets import load_iris

iris = load_iris()
X = iris.data

In [ ]:
%%async_run
import numpy as np
s = np.sum(X)
print(s)

Now the numpy module is available in the notebook namespace to be used


In [ ]:
a = np.array(range(10))

In [ ]:
a

In [ ]:
%%async_run
s = np.sum(a)

In [ ]:
s

In [ ]:
np.sum(range(10))

In [ ]:
%async_stop_server

In [ ]: